package com.qijian.business.domain.query;

import com.baomidou.mybatisplus.annotation.TableName;
import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Set;


/**
 * 生产工单对象 查询条件类
 *
 * @author qijian
 * @date 2024-02-23
 */

@Data
@ToString
@TableName("kr_work_order")
public class KrWorkOrderQuery {

    @WhereType(filed = "id")
    private Long id;
    @WhereType(filed = "fm_process_id")
    private Long fmProcessId;
    @WhereType(filed = "sort")
    private Integer sort;
    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private Set<Long> ids;
    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private List<Long> idList;
    @WhereType(filed = "source_id")
    private Long sourceId;
    @WhereType(filed = "start_date",type = WhereTypeEnum.BETWEEN)
    private Date[] startDate;
    @WhereType(filed = "end_date",type = WhereTypeEnum.BETWEEN)
    private Date[] endDate;
    @WhereType(filed = "status")
    private String status;
    @WhereType(filed = "size_tolerance")
    private String sizeTolerance;
    @WhereType(filed = "ts_el")
    private String tsEl;
    @WhereType(filed = "weight_tolerance")
    private String weightTolerance;
    @WhereType(filed = "package_mode")
    private String packageMode;
    @WhereType(filed = "pickup_direction")
    private String pickupDirection;
    @WhereType(filed = "bore_size")
    private String boreSize;
    @WhereType(filed = "surface")
    private String surface;
    @WhereType(filed = "order_no")
    private String orderNo;
    @WhereType(filed = "order_no", type = WhereTypeEnum.LIKE)
    private String orderNoLike;
    @WhereType(filed = "feed_no")
    private String feedNo;
    @WhereType(filed = "circulation_no")
    private String circulationNo;
    @WhereType(filed = "circulation_no", tableName = "kr_order_detail_pre_feed", type = WhereTypeEnum.LIKE)
    private String circulationNoLike;
    @WhereType(filed = "circulation_status")
    private String circulationStatus;
    @WhereType(filed = "circulation_date",type = WhereTypeEnum.BETWEEN)
    private Date[] circulationDate;
    @WhereType(filed = "is_contain")
    private Boolean isContain;
//    @WhereType(filed = "feed_status")
//    private String feedStatus;
    @WhereType(filed = "feed_by")
    private String feedBy;
    @WhereType(filed = "customer_name")
    private String customerName;
    @WhereType(filed = "delivery_date",type = WhereTypeEnum.BETWEEN)
    private Date[] deliveryDate;
    @WhereType(filed = "dept_name")
    private String deptName;
    @WhereType(filed = "number")
    private String number;
    @WhereType(filed = "number", type = WhereTypeEnum.LIKE)
    private String numberLike;
    @WhereType(filed = "prepared_by")
    private String preparedBy;
    @WhereType(filed = "qty")
    private BigDecimal qty;
    @WhereType(filed = "order_time",type = WhereTypeEnum.BETWEEN)
    private Date[] orderTime;
    @WhereType(filed = "line_id")
    private Long lineId;
    @WhereType(filed = "parent_id")
    private Long parentId;
    @WhereType(filed = "item_id")
    private Long itemId;
    @WhereType(filed = "item_code")
    private String itemCode;
    @WhereType(filed = "item_code", tableName = "work_order_pre_dispatch", type = WhereTypeEnum.LIKE)
    private String itemCodeLike;
    @WhereType(filed = "item_name")
    private String itemName;
    @WhereType(filed = "item_name", tableName = "work_order_pre_dispatch", type = WhereTypeEnum.LIKE)
    private String itemNameLike;
    @WhereType(filed = "item_spec")
    private String itemSpec;
    @WhereType(filed = "is_process")
    private Boolean isProcess;
    @WhereType(filed = "examine_status")
    private Boolean examineStatus;
    @WhereType(filed = "is_dispatch")
    private Boolean isDispatch;
    @WhereType(filed = "dispatch_number", tableName = "work_order_pre_dispatch", type = WhereTypeEnum.LIKE)
    private String dispatchNumberLike;
    @WhereType(filed = "bom_id")
    private Long bomId;
    @WhereType(filed = "bom_detail_id")
    private Long bomDetailId;
    @WhereType(filed = "to_u8_order_no")
    private String toU8OrderNo;
    @WhereType(filed = "order_type")
    private String orderType;
    @WhereType(filed = "unique_verify")
    private String uniqueVerify;

    @WhereType(func = "  exists (select 1 from kr_work_feed where kr_work_feed.source_id=kr_work_order.id and kr_work_feed.feed_status={1})")
    private String feedStatus;

    @WhereType(func = "kr_work_feed.feed_qty > kr_work_feed.out_qty")
    private Boolean outQty;

    @WhereType(filed = "circulation_no",tableName = "kr_order_detail_pre_feed",type = WhereTypeEnum.EQ)
    private String circulationNoEq;

    @WhereType(filed = "item_id", tableName = "kr_work_feed", type = WhereTypeEnum.EQ)
    private Long workFeedItemId;


    @WhereType(filed = "circulation_no",tableName = "kr_order_detail_pre_feed",type = WhereTypeEnum.EQ)
    private String circulationNos;

    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private List<Long> idIn;

    @WhereType(filed = "parent_id", type = WhereTypeEnum.IN)
    private List<Long> parentIdIn;

    @WhereType(filed = "id", tableName = "kr_work_feed")
    private Long workFeedId;
}
